﻿<?php require_once(dirname(__FILE__)."/../config/config.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<?php  
if($_SESSION['admin_name']=="")
{

	echo "<script>location.href='admin_login.php';</script>";
}
?>
<?php
	if(!empty($_POST['Submit'])){
	$shop_id=$_GET['id'];
	$mail=$_POST['mail'];
	$password=$_POST['password'];
	$username=$_POST['username'];
		if($mail!="" && $password!="" && $username!=""){
			$sql1=mysql_query("select * from zy_user where mail='".$mail."'");
			$rows=mysql_fetch_array($sql1);
			if($rows['mail']!=$mail){
				if($mail){             
					if (ereg("^[a-zA-Z0-9_\-\.]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$",$mail)){
			$sql="insert into zy_user(username,password,mail,integral,shop_id,remark,is_delete,create_user,create_time,update_user,update_time) values('$username','$password','$mail',0,'$shop_id','',0,'ww',now(),'ww',now())";
			mysql_query($sql);
			header("location:admin_management.php");
					}else{
					echo "Email格式不正确！";
					}
				}
			}else{
				echo "Email重复！";
			}
		}else{
			echo "Email、密码、昵称不能为空！";
		}
	}
?>
<h1 align="center">店铺管理员账号修改</h1>
<form id="form1" name="form1" method="post" action="">
  <p align="center">Email:
    <input name="mail" type="text" id="mail" />
</p>
  <p align="center">密码:
    <input name="password" type="text" id="password" />
  </p>
  <p align="center">昵称:  
    <input name="username" type="text" id="username" />
  </p>
  <p align="center">
    <input type="submit" name="Submit" value="注册" />
  </p>
</form>
</body>
</html>
